<template>
  <div style="display:inline-block;">
    <el-select
      v-model="gameType"
      placeholder="赛事类型"
      style="width: 200px"
    >
      <el-option :value="undefined">请选择</el-option>
      <el-option
        v-for="item in options"
        :key="item.gameType"
        :label="item.gameDesc"
        :value="item.gameType"
      />
    </el-select>
  </div>
</template>

<script>
// 引入API接口函数
import {gameTypeList} from '@/api/video/gameType'

export default {
  props: {
    value: {
      placeholder: String,
      disabled: Boolean,
      value: [String, String],
    }
  },
  data() {
    return {
      options: []
    }
  },
  created() {
    // console.log(this.dictCode);
    //获取赛事类型
    this.getGameTypeList();
  },
  computed: {
    gameType: {
      get() {
        return this.value
      },
      set(val) {
        console.log(val);
        this.$emit('input', val)
      }
    }
  },
  methods: {
    getGameTypeList() {
      const that = this
      gameTypeList().then((res) => {
        that.options = res.data
      })
    },
    handleInput(e='') {
      let val;
      if(Object.keys(e).includes('target')){
        val = e.target.value
      }else{
        val = e
      }
      console.log(val);
      this.$emit('change', val);
    },
  },
}
</script>
